#include <iostream>
#include <cmath>
#include <sstream>
using namespace std;
bool isPrime(int n)
{
    if( n == 0) return false;
    if( n == 1) return false;
    for(long i = 2; i<=(int)sqrt(n); i++)
    {
        if(n%i == 0)
            return false;
    }
    return true;
}
int main()
{
    int L,N;
    string sNum;
    string  sTemp;
    cin>>L>>N>>sNum;
    bool bIfFind = false;
    for(int i = 0; i<=L-N; i++)
    {
        sTemp = sNum.substr(i,N);
        stringstream ss;
        ss<<sTemp;
        int num;
        ss>>num;
        if(isPrime(num))
        {
            bIfFind = true;
            cout<<sTemp;
            break;
         }
    }
    if(!bIfFind)
        cout<<"404";
}